#include <iostream>
#include <cstring>
#include <random>
#include <algorithm>
#include <cassert>

const int N = 1e6 + 5;
const int M = 35;
const int step[4][2] = {
	{-1, 0}, {1, 0}, {0, -1}, {0, 1}
};
const char cstep[] = "UDLR";

int n, m = 30;
char str[N];
int s[M][M], a[N];
unsigned ok[N][M];
unsigned mask[4][M];
char word[] = " BGR";
std::mt19937 rnd(0x114514);
unsigned key;
int p = 32;
char ans[N];

inline bool getbinary() {
	if(p == 32) key = rnd(), p = 0;
	return (key >> p++) & 1;
}

void gen() {
	for(int i = 1; i <= m; ++i) {
		for(int j = 1; j <= m; ++j) {
			if(i % 3 == 1) {
				if(j % 6 == 1 || j % 6 == 2) s[i][j] = 3;
				else if(j % 6 == 3 || j % 6 == 4) s[i][j] = 2;
				else s[i][j] = 1;
			} else if(i % 6 == 2 || i % 6 == 3) {
				if(j % 6 == 1 || j % 6 == 4) s[i][j] = 1;
				else if(j % 6 == 2 || j % 6 == 0) s[i][j] = 2;
				else s[i][j] = 3;
			} else {
				if(j % 6 == 2 || j % 6 == 3) s[i][j] = 1;
				else if(j % 6 == 1 || j % 6 == 5) s[i][j] = 2;
				else s[i][j] = 3;
			}
		}
	}
}

bool check() {
	int x = 0, y = 0;
	/*
	for(int i = m / 2 - 3; i <= m / 2 + 3; ++i) if(s[m / 2][i] == a[1]) {
		x = m / 2, y = i;
		break;
	}
	*/
	do {
		x = rnd() % m + 1, y = rnd() % m + 1;
	} while(x == 1 || x == m || y == 1 || y == m || s[x][y] != a[1]);
	assert(s[x][y] == a[1]);
	int x0 = x, y0 = y;
	for(int i = 2; i <= n; ++i) {
		bool ok = 0;
		if(getbinary()) {
			for(int j = 0; j < 4; ++j) {
				int nx = x + step[j][0];
				int ny = y + step[j][1];
				if(s[nx][ny] == a[i]) {
					x = nx, y = ny;
					ans[i] = cstep[j];
					ok = 1;
					break;
				}
			}
		} else {
			for(int j = 3; j > -1; --j) {
				int nx = x + step[j][0];
				int ny = y + step[j][1];
				if(s[nx][ny] == a[i]) {
					x = nx, y = ny;
					ans[i] = cstep[j];
					ok = 1;
					break;
				}
			}
		}
		if(!ok) return 0;
	}
	std::cout << m << " " << m << "\n";
	for(int i = 1; i <= m; ++i) {
		for(int j = 1; j <= m; ++j) std::cout << word[s[i][j]];
		std::cout << "\n";
	}
	std::cout << x0 << " " << y0 << "\n";
	for(int i = 2; i <= n; ++i) std::cout << ans[i]; std::cout << "\n";
	return 1;
}

/*
void checkok() {

	for(int i = 1; i <= m; ++i) for(int j = 1; j <= m; ++j) ok[0][i][j] = 1;
	for(int t = 1; t <= n; ++t) {
		for(int i = 1; i <= m; ++i) {
			for(int j = 1; j <= m; ++j) {
				ok[t][i][j] = (s[i][j] == a[t]) && 
					(
					ok[t-1][i-1][j] ||
					ok[t-1][i+1][j] ||
					ok[t-1][i][j-1] ||
					ok[t-1][i][j+1]
					);
			}
		}
	}
	bool okk = 0;
	for(int i = 1; i <= m; ++i) for(int j = 1; j <= m; ++j) if(ok[n][i][j]) okk = 1;
	std::cerr << okk << "\n";
}
*/

inline void dfs(int i, int x, int y) {
	//std::cerr << "dfs = " << i << " " << x << " " << y << "\n";
	if(i == 1) {
		std::cout << x << " " << y << "\n";
		return;
	}
	assert(ok[i][x] >> y & 1);
	if(ok[i-1][x] >> (y - 1) & 1) {
		dfs(i - 1, x, y - 1);
		std::cout << "R";
	} else if(ok[i-1][x] >> (y + 1) & 1) {
		dfs(i - 1, x, y + 1);
		std::cout << "L";
	} else if(ok[i-1][x-1] >> y & 1) {
		dfs(i - 1, x - 1, y);
		std::cout << "D";
	} else if(ok[i-1][x+1] >> y & 1) {
		dfs(i - 1, x + 1, y);
		std::cout << "U";
	} else {
		assert(0);
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);

	std::freopen("snake.in", "r", stdin);
	std::freopen("snake.out", "w", stdout);

	std::cin >> (str + 1);
	n = std::strlen(str + 1);
	for(int i = 1; i <= n; ++i) a[i] = std::find(word + 1, word + 4, str[i]) - word;
	gen();
	for(int i = 1; i <= m; ++i) for(int j = 1; j <= m; ++j) ok[0][i] |= 1u << j;
	for(int i = 1; i <= m; ++i) for(int j = 1; j <= m; ++j) mask[s[i][j]][i] |= 1u << j;
	for(int t = 1; t <= n; ++t) {
		for(int i = 1; i <= m; ++i) {
			ok[t][i] = ((ok[t-1][i] << 1) | (ok[t-1][i] >> 1) | ok[t-1][i-1] | ok[t-1][i+1]) & mask[a[t]][i];
		}
	}
	for(int x = 1; x <= m; ++x) for(int y = 1; y <= m; ++y) if(ok[n][x] >> y & 1) {
		std::cout << m << " " << m << "\n";
		for(int i = 1; i <= m; ++i) {
			for(int j = 1; j <= m; ++j) std::cout << word[s[i][j]];
			std::cout << "\n";
		}
		dfs(n, x, y);
		std::cout << "\n";
		return 0;
	}
	assert(0);

	return 0;
}
